Repository navigation
fix(workspace): list --json past the argument size limit; isolate test registry - #102
Merged
Merged
Conversation
…t registry xcind-workspace list --json passed the assembled workspace array to jq through --argjson. Linux caps a single argument at 128 KiB (MAX_ARG_STRLEN), so a registry of about two thousand entries failed with "Argument list too long". Stream one TSV row per workspace into a single jq on stdin instead. This also replaces one jq spawn per row. The output shape is unchanged. The registry grew that large because the test suite registered its tempdir fixtures in the developer's real workspaces.tsv: - The test files source xcind-lib.bash, which computes the registry path from the real XDG_STATE_HOME/HOME. test/lib/setup.sh now exports XDG_STATE_HOME under the test temp root and rebinds the registry globals. - test-xcind-proxy.sh unsets XDG_STATE_HOME and "restores" HOME to the real home between blocks, so later xcind-workspace init/status tests wrote to the real registry. REAL_HOME is now a sandbox. Existing stale rows can be removed with xcind-workspace list --prune.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xcind-workspace list --jsonfailed withjq: Argument list too longwhen the workspace registry was large. This PR fixes the command and the test-suite leak that made the registry large.Cause
jqas one--argjsonvalue. Linux limits a single argument to 128 KiB (MAX_ARG_STRLEN). A registry of about 1,950 rows was larger than that limit.~/.local/state/xcind/workspaces.tsv. In the observed case, 1,946 of 1,949 rows were stale/tmppaths.Changes
bin/xcind-workspace:list --jsonwrites one TSV row per workspace to the stdin of a singlejq -nR. The JSON no longer goes through an argument. The command also starts onejqprocess instead of one per row. The output shape does not change.test/lib/setup.sh: exportsXDG_STATE_HOMEunder the test temp root and rebinds theXCIND_REGISTRY_*globals. The test files sourcexcind-lib.bashbefore this file, so the globals had the real path.test/test-xcind-proxy.sh:REAL_HOMEis now a sandbox directory. This file unsetsXDG_STATE_HOME, and its blocks "restore"HOMEthroughREAL_HOME. Before this change, the laterxcind-workspace init/statustests wrote to the real registry.Verification
make checkpasses.make testrun. Before the fix, each run added rows.xcind-workspace list --jsonreturns valid JSON for a registry of 1,949 rows.Note for developers
To remove stale rows from an earlier test run, use
xcind-workspace list --prune.